# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer:  Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=perl-mail-clamav
_pkgname=Mail-ClamAV
pkgver=0.30
pkgrel=1
pkgdesc="Perl extension for the clamav virus scanner"
url="https://metacpan.org/pod/Mail::ClamAV"
arch="all"
license="Artistic-1.0-Perl OR GPL-1.0-or-later"
depends="perl clamav"
makedepends="bzip2-dev clamav-dev zlib-dev
	perl-dev perl-inline perl-inline-c perl-parse-recdescent
	"
options="!check" # requires clamav db in /var/lib/clamav
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/C/CA/CAVAC/Mail-ClamAV-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	sed -i -e 's%\(clamav-config --version\)%sh /usr/bin/\1%' Makefile.PL
	default_prepare
	PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
}

build() {
	export CFLAGS=`perl -MConfig -E 'say $Config{ccflags}'`
	make -j1
}

check() {
	make test
}
package() {
	make DESTDIR="$pkgdir" INSTALLDIRS=vendor install
	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}

sha512sums="0a6a029df2a46cbf09eeade22cd8b525f4e75c80f05a4833e41c52b4c1653f8f1cca6e19f6011354f053e3b4ec235d75bcf672bf91f63d0f5a92914f2e1f4e89  Mail-ClamAV-0.30.tar.gz"
